//
//  Model_AllComment.m
//  yjw-winner
//
//  Created by 王春辉 on 2018/9/25.
//  Copyright © 2018年 Shanghai decade financial information service co., LTD. All rights reserved.
//

#import "Model_AllComment.h"

@implementation Model_AllComment
- (CGFloat)cellHeight {
    return 90 + [self commentHeight] + [self repliesHeight];
}

/**
 计算评论文字高度

 @return height
 */
- (CGFloat)commentHeight {
    if (_comments.length) {
        return [_comments boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 20, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.commentsFont} context:nil].size.height + 20;
    }else {
        return 0;
    }
}

/**
 计算回复内容高度

 @return height
 */
- (CGFloat)repliesHeight {
    if (_replies.length) {
        return [_replies boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 20 - 16, 100) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size.height + 10;
    }else {
        return 0;
    }
}

@end
